package com.woniuxy.seckill.controller;

import com.hc.entity.Discount;
import com.rabbitmq.client.Channel;
import com.woniuxy.seckill.mapper.DiscountMapper;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @BelongsProject: hc
 * @BelongsPackage: com.woniuxy.seckill.controller
 * @Author: WY
 * @CreateTime: 2022-10-26  11:36
 * @Descriprion: TODO
 * @Version: 1.0
 **/
@Component
public class MyConsumter {

    @Autowired
    DiscountMapper discountMapper;

    @RabbitListener(queues = "mark1")
    public void receiveMsg(Discount discount, Message message, Channel channel){
        discountMapper.addDiscount(discount);
    }
}
